package com.quarters.controller.admin;


import com.quarters.bean.UserInfo;
import com.quarters.bean.ztree.ZtreeBean;
import com.quarters.commen.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 冯政尚
 * @since 2019-09-02
 */
@Controller
@RequestMapping("admin/menu")
public class MenuController extends BaseController {


    @RequestMapping(value = "/findPermission", method = RequestMethod.POST)
    @ResponseBody
    public List<ZtreeBean> findPermission(HttpSession session) {
        return menuService.findMenuZtree(getUserInfo(session).getId());
    }

    @RequestMapping(value = "/findMenus", method = RequestMethod.POST)
    @ResponseBody
    public List<ZtreeBean> findMenu( ) {
        return menuService.findMenu();
    }

    @RequestMapping("/findMenu")
    @ResponseBody
    public UserInfo findMenu(HttpSession session){
        UserInfo user=new UserInfo();
        user=(UserInfo)session.getAttribute("userInfo");
        return user;
    }

}
